<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Register New User</title>
</head>
<jsp:directive.page import="java.util.*"/>
<%
try{
   	if (request.getSession().getAttribute("userId")!= null)
   		 response.sendRedirect("AccessDenied.jsp");
   }catch(Exception e){
   }
   %>
<body style="background-color: #94C0D6">
	<img alt="" src="Swim.jpg" style="height: 64px; width: 200px;">
	<form
		style="background-color: #A6B0DB; border-bottom-width: thin; border-right-width: thin; border-left-width: thin; border-top-width: thin; border-top-color: #8080FF; border-right-color: #8080FF; border-top-style: solid; border-right-style: solid; height: 24px;">
		<a href="Index.jsp">Back.</a>
	</form>		
	<br><center><form style="width: 218px; background-color: #8080FF; height: 22px; vertical-align: middle; border-top-style: solid; border-top-color: #8080C0; border-right-color: #8080C0; border-right-width: thin; border-right-style: solid; border-top-width: thin">
			<center>
				<b>REGISTER NEW USER</b>
			</center>
		</form>
		<br/>(*) all fields are mandatory
		</center>
		<br><br>
	
	<form action="RegistrationServlet" method = "post" style="height: 274px;">
		<table border="0" cellspacing="0" cellpadding="5" align="center" style="background-color: #8080C0">
			<tr>
				<td><b> Username:</b></td>
				<td align="right"><input type="text" name="username"></td>
			</tr>
			<tr>
				<td><b>Password:</b></td>
				<td><input type="Password" name="password"></td>
			</tr>
			<tr>
				<td><b>Confirm<br/>password:</b></td>
				<td><input type="Password" name="confirm"></td>
			</tr>
			<tr>
				<td><b> Name:</b></td>
				<td align="right"><input type="text" name="name"></td>
			</tr>
			<tr>
				<td><b> Surname:</b></td>
				<td align="right"><input type="text" name="surname"></td>
			</tr>
			<tr>
				<td><b> E-mail:</b></td>
				<td align="right"><input type="text" name="e-mail"></td>
			</tr>
			<tr>
				<td><b> Address:</b></td>
				<td align="right"><input type="text" name="address"></td>
			</tr>
			<tr>
				<td><b> Town:</b></td>
				<td align="right"><input type="text" name="town"></td>
			</tr>
			<tr>
				<td><b>Ability:</b></td>
				<td style="height: 22px;">
					<select name="ability" id="Select1"
					size='
    				<%
    					ArrayList<String> abilityList = (ArrayList<String>)request.getSession().getAttribute("abilities");
   						if (abilityList!= null){
    						int length = abilityList.size();
    					out.print(length); 
    					}
   						else { out.print(0);
    				}%>'
					multiple="multiple" style="height: 84px; width: 146px">
					<%
   	 				int i=0;
   					if (abilityList != null){
    					for(String ability : abilityList){
    						out.println("<option name = \"value\" value=\"" + ability + "\">" + ability + "</option>");
    						i++;
     						}
    					out.println("<option name = \"value\" value=\"no ability\"> Nothing </option>");
     				}
    %>
				</select></td>
			</tr>
		</table>
		<center>
			<input type="submit" value="Register" style="background-color: #8080FF"/>
		</center>
	</form>
</body>
</html>